/*
 * @Author: 一路向阳 tt_sunzhenfeng@163.com
 * @Date: 2024-05-26 17:36:32
 * @LastEditors: 一路向阳 tt_sunzhenfeng@163.com
 * @LastEditTime: 2024-05-26 21:24:06
 * @FilePath: \vue3_nuxt_demo\apis\notebook.ts
 * @Description: 文集接口
 */
import { useHttpFetch, type IFetchOptions } from '@/composables/useHttpFetch';

// 获取文集列表
interface INoteBookList extends IFetchOptions {}
export const noteBookList = (opt: INoteBookList) => {
  return useHttpFetch('/api/notebook', {
    ...opt,
    method: 'GET',
    key: 'noteBookList'
  });
}


// 创建文集
interface INoteBook extends IFetchOptions {
  id?: number;
  name?: string;
}
export const addNoteBook = (opt: INoteBook) => {
  return useHttpFetch('/api/notebook', {
    ...opt,
    method: 'POST',
    key: 'addNoteBook'
  });
}

export const updateNoteBook = (opt: INoteBook) => {
  return useHttpFetch('/api/notebook', {
    ...opt,
    method: 'PUT',
    key: 'updateNoteBook'
  });
}

export const deleteNoteBook = (opt: INoteBook) => {
  return useHttpFetch('/api/notebook', {
    ...opt,
    method: 'DELETE',
    key: 'deleteNoteBook'
  });
}

// 文集下的文章
interface INotes extends IFetchOptions {
  notebookId?: number;
}
export const nodetsList = (opt: INotes) => {
  return useHttpFetch('/api/notebook/note_all', {
    ...opt,
    method: 'GET',
    key: 'nodetsList'
  });
}
